package com.hengfoxwolf.ffmpegdemo.util

class AudioSLPlayer {

    private var audioSLPlayerCallback: AudioSLPlayerCallback? = null

    fun setAudioSLPlayerCallback(audioSLPlayerCallback: AudioSLPlayerCallback?) {
        this.audioSLPlayerCallback = audioSLPlayerCallback
    }

    private fun playAudioCallback() {
        if (audioSLPlayerCallback != null) {
            audioSLPlayerCallback!!.onAudioSLPlayerCallback()
        }
    }

    external fun init()
    external fun play(path: String?)
    external fun playPause(playPause: Boolean)
    external fun seekToPlay(seekToTime: Int)
    external fun stop()
    external fun destroy()

    interface AudioSLPlayerCallback {
        fun onAudioSLPlayerCallback()
    }

    companion object {
        init {
            System.loadLibrary("audio-opensl-lib")
        }
    }
}